/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.pi2.osr.ejb.entities;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
import javax.persistence.GenerationType;
import javax.persistence.SequenceGenerator;
import javax.persistence.GeneratedValue;
/**
 *
 * @author admin
 */
@Entity
@Table(catalog = "", schema = "P09713_2_10")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Ordensuministro.findAll", query = "SELECT o FROM Ordensuministro o"),
    @NamedQuery(name = "Ordensuministro.findByFecha", query = "SELECT o FROM Ordensuministro o WHERE o.fecha = :fecha"),
    @NamedQuery(name = "Ordensuministro.findByIdordensuministro", query = "SELECT o FROM Ordensuministro o WHERE o.idordensuministro = :idordensuministro")})
public class Ordensuministro implements Serializable {
    private static final long serialVersionUID = 1L;
    @Basic(optional = false)
    @NotNull
    @Column(nullable = false)
    @Temporal(TemporalType.TIMESTAMP)
    private Date fecha;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Id
    @SequenceGenerator(name="ORDENSUMINISTRO_IDORDENSUMINISTRO_GENERATOR", sequenceName="ORDENSUMINISTRO_SEQ", allocationSize=1)
    @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="ORDENSUMINISTRO_IDORDENSUMINISTRO_GENERATOR")
    @Basic(optional = false)
    @NotNull
    @Column(nullable = false, precision = 0, scale = -127)
    private BigDecimal idordensuministro;
    @JoinColumn(name = "IDPROVEEDOR", referencedColumnName = "IDPROVEEDOR", nullable = false)
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private Proveedor idproveedor;
    @JoinColumn(name = "IDESTADO", referencedColumnName = "IDESTADO", nullable = false)
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private Estado idestado;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idordensuministro1", fetch = FetchType.LAZY)
    private List<Detallesuministro> detallesuministroList;

    public Ordensuministro() {
    }

    public Ordensuministro(BigDecimal idordensuministro) {
        this.idordensuministro = idordensuministro;
    }

    public Ordensuministro(BigDecimal idordensuministro, Date fecha) {
        this.idordensuministro = idordensuministro;
        this.fecha = fecha;
    }

    public Date getFecha() {
        return fecha;
    }

    public void setFecha(Date fecha) {
        this.fecha = fecha;
    }

    public BigDecimal getIdordensuministro() {
        return idordensuministro;
    }

    public void setIdordensuministro(BigDecimal idordensuministro) {
        this.idordensuministro = idordensuministro;
    }

    public Proveedor getIdproveedor() {
        return idproveedor;
    }

    public void setIdproveedor(Proveedor idproveedor) {
        this.idproveedor = idproveedor;
    }

    public Estado getIdestado() {
        return idestado;
    }

    public void setIdestado(Estado idestado) {
        this.idestado = idestado;
    }

    @XmlTransient
    public List<Detallesuministro> getDetallesuministroList() {
        return detallesuministroList;
    }

    public void setDetallesuministroList(List<Detallesuministro> detallesuministroList) {
        this.detallesuministroList = detallesuministroList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idordensuministro != null ? idordensuministro.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Ordensuministro)) {
            return false;
        }
        Ordensuministro other = (Ordensuministro) object;
        if ((this.idordensuministro == null && other.idordensuministro != null) || (this.idordensuministro != null && !this.idordensuministro.equals(other.idordensuministro))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.pi2.osr.ejb.entites.Ordensuministro[ idordensuministro=" + idordensuministro + " ]";
    }
    
}
